<template>
    <el-tag type="info">{{ sourceData.id }} ) {{ sourceData.name }}</el-tag>
</template>

<script>
    export default {
        props: ['source'],
        data () {
            return {};
        },
        watch: {},
        computed: {
            appSources() {
                return this.$store.state.appSource.all;
            },
            sourceData() {
                let data = {
                    id: this.source || '0',
                    name: this.source || '未设置',
                };
                for (let i in this.appSources) {
                    if (this.appSources[i].id === parseInt(this.source)) {
                        data = this.appSources[i];
                        break;
                    }
                }
                return data;
            },
        },
        methods: {
            getAppSources() {
                if (!this.appSources.length) this.$store.dispatch('appSource/All', 'appSource');
            }
        },
        created() {
            this.getAppSources();
        }
    }
</script>

<style scoped>

</style>
